How to create connection string dynamically in C#

98

How to create connection string dynamically in C# -

private void Form1_Load(object sender, EventArgs e)
{
     SqlConnectionStringBuilder connectionString = new SqlConnectionStringBuilder();
     connectionString.DataSource = @".\SQLEXPRESS";
     connectionString.InitialCatalog = "MyDatabase";
     connectionString.IntegratedSecurity = true;
     MessageBox.Show(connectionString.ConnectionString);
}

Comments

Submit
0 Comments